<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="./common/base.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导游_约导游</title>
<!--css-->
<link rel="stylesheet" type="text/css" href="css/wutongstyle.css">
<script src="js/page.js" type="text/javascript"></script>
</head>

<body>
<!--head begin-->
<%@ include  file="./common/header.jsp"%>
<!--nav end--> 
<!--content begin-->
<div class="wt_content">
  <dl class="yuedaoyou daoyou">
    <dt><span>您的位置：<a href="index.jsp">约导游</a> &gt; <a href="dylist.jsp">导游</a></span>导游</dt>
    <dd>
      <ul class="indexpic clearfix" id="guideListMoreId">

      </ul>
      <div class="n_page clearfix">
           <ul id="1_fenyeId">
                  
        </ul>
      </div>
    </dd>
  </dl>
</div>
<!--content end--> 
<!--footer begin-->
<%@ include  file="./common/footer.jsp"%>
<!--footer end--> 
<script>
var pageIndex=1;
var pageSize=18;
var pageCount = 0;
var recordCount = 0;
$(function(){
	loadAllGuideList(pageIndex,pageSize);
});
$('#menu li a').on('click',function (){
  $('#menu li').removeClass('focus');
  $(this).parent().addClass('focus');
  $("#selIndexCityId").html($(this).html());
  document.getElementById('menu').style.display='none';
  $.cookie("selCity",$(this).html());
  loadAllGuideList(pageIndex,pageSize);
})
function loadAllGuideList(p_pageIndex,p_pageSize){
	selCity =  getCurrCity();
	var objp= "{\"pageIndex\":\""+(p_pageIndex-1)+"\","+
   		 "\"pageSize\":\""+p_pageSize+"\","+
   		"\"city\":\""+selCity+"\""+
    "}";
	$.ajax({
	 url: '${path}/core/getGuideListByScore',
	 type: 'POST',
	 timeout: 30000,
	 cache : false,
	 data :objp,
	 async: false,
	 dataType:"json",      
	 contentType:"application/json",   
	// contentType: "application/json; charset=utf-8",
	 success:function(msg){
		  //alert(msg.totalCount)
		  formatAllGuideList(msg.dataList);
		  formatFenYe(msg.totalCount);
	 },
	  failure:function(msg){
		   alert(eval('('+msg.responseText+')').error_text);
	  		
	  },
	  error:function(msg){
		   alert(eval('('+msg.responseText+')').error_text); 
	  }
	});
}
function formatAllGuideList(data){
	
	  if(data && data.length>0) {
		  $("#guideListMoreId").empty();
		  for(var k=0;k<data.length;k++) {
			  var workyear=1;
			  var description="暂无说明";
			  if(data[k].workyear!=null && data[k].workyear!=""){
				  workyear = data[k].workyear;
			  }
			  if(data[k].description!=null && data[k].description!=""){
				  if(data[k].description.length>36){
					  description = data[k].description;
					  description = description.substring(0,36)+"...";
				  }else{
					  description = data[k].description;
				  }
			  }
			  var registerStatue="";
			  if(data[k].status==1) {
				  registerStatue="<t class=\"renzheng\">已认证</t>";
			  }
			  $("#guideListMoreId").append("<li>"+
			          "<div class=\"pic\">"+
                           "<a href=\"dyinfo.jsp?guideId="+data[k].id+"\"><img src=\""+imgDomain+data[k].photo+"\" /></a>"+
                           "<span class=\"bg\"></span>"+
                           "<span class=\"tt\"><a href=\"javascript:void(0)\">"+data[k].name+"</a></span>"+
                      "</div>"+
			          "<div class=\"txt\">"+
			            "<p><span>从业<b>"+workyear+"</b>年</span>"+registerStatue+"</p>"+//+data[k].workyear+
			            description+
			          "</div>"+
			        "</li>"
			  );
		  }
	  }else{
		  $("#guideListMoreId").empty();
		  $("#guideListMoreId").html("暂无数据");
	  }
	}
function formatFenYe(totalCount){
	 recordCount = totalCount;
	 pageCount = Math.ceil(recordCount/pageSize);
	 pageRefresh(function () { 
		 loadAllGuideList(pageIndex,pageSize);
	 });
}
    </script>
</body>
</html>
